package com.yowasa.xiuxian.engine.battle.buff;

import com.yowasa.xiuxian.annoations.Buff;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.BuffContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import org.springframework.beans.factory.annotation.Autowired;

@Buff(name = "七步毒")
public class QiBuBuff implements BuffInterface {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public void beforeBuffAction(UserBattleContent first, UserBattleContent second, BattleContent content) {
        BuffContent buff = first.getBuff().get("七步毒");
        int spd = first.getBattleInfo().getSpd();
        int immAtk = (int) (spd * 0.1 * buff.getNum());
        int dmg = battleHelper.calImm(immAtk, first.getBattleInfo().getImm());
        first.getBattleInfo().setChp(first.getBattleInfo().getChp() - dmg);
        content.getMsgLog().add(first.getUserBO().getName() + "因七步毒失去了" + dmg + "点血");
    }
}
